﻿using M56.Model.Barrage.Dto;
using Microsoft.AspNetCore.Mvc;

namespace M56.Admin.WebApi.Controllers.Barrage
{
    /// <summary>
    /// 江湖对决
    /// </summary>
    [Route("/jh")]
    [AllowAnonymous]
    public class JhController : BaseController
    {
        /// <summary>
        /// 进入游戏
        /// </summary>
        /// <returns></returns>
        [Route("enter")]
        [HttpPost]
        public IActionResult Enter([FromBody] JhClientInfoDto info)
        {
            var data = new Dictionary<string, object>
            {
                { "GameId", 9 },
                { "OpenId", "f185f1c914f80e7114bf572494e9b516" },
                { "RoundId", "" },
                { "RoomId", info.Data["Token"]},
                { "BindUrl", "" },
                { "Nickname", "TTTT" },
                { "AvatarUrl", "http://p4.a.yximgs.com/uhead/AB/2023/10/09/02/BMjAyMzEwMDkwMjIwMDVfMTI5NTgwNzgyOF8xX2hkNjYzXzgxOQ==_s.jpg" },
                { "ExpireTime", 0 },
                { "ExtraFlag", 0 },
                { "CrawlerArg", "" },
                { "Token", Guid.NewGuid().ToString() },
                { "Uid", 821319681846534543 },
                { "Ws", "" },
                { "WebSocketUrl", "ws://127.0.0.1:9549/ws" },
                { "Segment", 1 },
                { "Star", 0 }
            };

            var result = new Dictionary<string, object>
            {
                { "Code", 0 },
                { "Msg", "success" },
                { "Data", data }
            };

            return Ok(result);
        }
    }
}
